package com.medata.utils;

import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Random;

/**
 * @author ：zb
 * @date ：Created in 2019/5/13 0013 19:47
 * @description：
 */

public class UidUtil {
    private static Random random=new Random();
    public static String getMid(){
//        int i=random.nextInt(100);
        DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyyMMdd");
        String s = LocalDateTime.now(ZoneOffset.of("+8")).format(formatter);
        return s;
    }

    public static String getUid(){
        int i=random.nextInt(10000);
        String s=String.valueOf(LocalDateTime.now().toInstant(ZoneOffset.of("+8")).getEpochSecond());
        return s+String.valueOf(i);
    }

    public static void main(String[] args) {
        System.out.println(getUid());
    }
}
